package cnhy.salary.cfg;

import cnhy.salary.controller.MonthlyCfgController;
import cnhy.salary.service.WageSvc;
import com.ruoyi.common.utils.DateUtils;
import lombok.var;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;


@Component("salaryTask")
public class SalaryTask
{

    @Resource
    private MonthlyCfgController monthlyCfgController;
    //每月1号00:03:01生成月信息维护，数据来源于上个月的
    public void createMonthlyBaseCfg(Integer addDay)
    {
        var date=new Date();
        if(addDay!=null&&addDay!=0)
        {
            date=DateUtils.addDays(date,addDay);
        }
        monthlyCfgController.createMonthlyBaseCfg(date);
    }

    public void createMonthlyBill(Integer addDay)
    {
        var date=new Date();
        if(addDay!=null&&addDay!=0)
        {
            date=DateUtils.addDays(date,addDay);
        }
        wageSvc.createMonthlyBill(date);
    }

    @Resource
    WageSvc wageSvc;
    public void createDailyBill(Integer addDay)
    {
        var date=new Date();
        if(addDay!=null&&addDay!=0)
        {
            date=DateUtils.addDays(date,addDay);
        }
        wageSvc.createDailyBill(date);
    }

}